<template>
  <div class="info">
     <div v-if="this.$store.state.curUser==null">
        <router-link to="/login">请登录</router-link>
     </div>
     <div v-else>
        <div style="float:left"><el-avatar size="large" :src="'http://localhost:9999/imgs/user/'+this.$store.state.curUser.photo" /></div>
        <div>{{this.$store.state.curUser.name}}<br/><span @click="logout">【注销】</span></div>
     </div>
  </div>
</template>

<script>
import router from "../router";
export default {
   data(){
       return {
          
       }
   },
   methods:{
      logout:function(){
         this.$store.commit("delCurUser");
         sessionStorage.removeItem("token");
         router.push("/login");
      }
   }
}
</script>

<style scoped>
   .info{font-size:12px;padding:10px}
</style>